package Form;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTable;

import DataSetPackage.DataSet;

import javax.swing.JScrollPane;
import javax.swing.JLabel;

public class ViewDataForm extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final JPanel contentPanel = new JPanel();
	private JTable table;

	/**
	 * Create the dialog.
	 */
	public ViewDataForm(DataSet data) {
		setLocationByPlatform(true);
		setBounds(100, 100, 600, 400);
		String[] colName = data.getColumnName();
		String[][] values = data.getRawData();
		getContentPane().setLayout(new BorderLayout());
		{
			JPanel panel = new JPanel();
			FlowLayout flowLayout = (FlowLayout) panel.getLayout();
			flowLayout.setAlignment(FlowLayout.LEFT);
			getContentPane().add(panel, BorderLayout.NORTH);
			{
				JLabel lblInfo = new JLabel("Number of Attributes : "+colName.length+"    Number of Instances :"+values.length);
				panel.add(lblInfo);
			}
		}
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new BorderLayout(0, 0));
		{

			table = new JTable(values,colName);	
			JScrollPane scrollPane = new JScrollPane(table);
			//table.setFillsViewportHeight(true);
			
			contentPanel.add(scrollPane);
		}
	}

}
